#include <iostream>
#include <map>
#include <cstring>

using namespace std;

#define PAGE_MAX 48
#define CONFIG_ITEM_MAX 48

enum dst
{
    TASK_ACMC
};
enum
{
    BUSINESS_ADD_WLAN_SSID,
    BUSINESS_DEL_WLAN_SSID,
    BUSINESS_MODIFY_WLAN_SSID,
    BUSINESS_QUERY_WLAN_SSID,
};
enum
{
    OP_ADD = 1,
    OP_DELETE,
    OP_MODIFY,
    OP_QUERY,
    OP_ENABLE,
    OP_DISABLE,
    OP_EXTRA1,
    OP_EXTRA2,
    OP_REBOOT,
    OP_MAX
};

enum
{
    TP_TEXT,
    TP_NUMBER,
    TP_DATE,
    TP_URL,
    TP_SELECT,
    TP_DOMAIN,
    TP_EMAIL,
    TP_NAME,
    TP_IP,
    TP_MASK,
    TP_MAX
};

struct configItem
{
    string key; //配置项key
    string show; //friend name
    int type; //inputtext|inputnum|select|textarea|password 待商榷
    //这里如果是select类型的话数据会比较复杂
    int minValue;
    int maxValue;
    string regexRule;
    string ruleShow;//文本：应在X~XX范围内|不能包含XXX字符
};

struct info
{
    int dst;
    string title;
    string dbName;
    string tableName;
};

struct allset
{
    string name;
    struct info pageInfo;
    int opcodes[OP_MAX];
    struct configItem configItems[CONFIG_ITEM_MAX];
};

const struct allset pageSets[PAGE_MAX] =
{
    "gwlsrv",
    {TASK_ACMC,"Wlan服务策略","ap_manager","wlan_ssid"},
    {
        BUSINESS_ADD_WLAN_SSID,
        BUSINESS_DEL_WLAN_SSID,
        BUSINESS_MODIFY_WLAN_SSID,
        BUSINESS_QUERY_WLAN_SSID,
        -1
    },
    {
        "name", "策略名", TP_NAME, 0, 0, "", "",
        "essid", "ESSID", 0, 0, 0, "", "",
        "max_users", "最大用户数", 0, 0, 0, "", "",
        "vlan_id", "VLAN ID", 0, 0, 0, "", "",
        "wlan_id", "WlAN ID", 0, 0, 0, "", "",
        "qos", "Qos", 0, 0, 0, "", "",
        "capability", "能力级", 0, 0, 0, "", "",
        "security", "安全策略", 0, 0, 0, "", "",
        "tunnel_enable", "", 0, 0, 0, "", "",
        "url", "", 0, 0, 0, "", "",
        "mac_mode", "", 0, 0, 0, "", "",
        "suppress_ssid", "", 0, 0, 0, "", "",
        "band_width", "", 0, 0, 0, "", "",
        "portal_enable", "", 0, 0, 0, "", "",
        ""
    }
};

int main()
{
    cout << pageSets[0].configItems[3].show << endl;
    int i;
    for (i = 0; i < OP_MAX && pageSets[0].opcodes[i] != -1; i++);
    cout << i << endl;
    return 0;
}
